﻿using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Menu_Footer : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataSet ds = new DataSet();
            ds.ReadXml(Server.MapPath("~/App_Data/AppVersion.xml"));
            if (ds.Tables.Count > 0)
            {
                LtrlProdVersion.Text = ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["version"].ToString();
                LtrlReleaseDate.Text = string.Format("{0:dd/MM/yyyy}", Convert.ToDateTime(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["releasedate"].ToString()));
            }
        }

        if (Session["FINYEAR"] == null)
        {
            Response.Redirect("~/SessionExpired.aspx");
        }
        LblCompName.Text = Session["compname"].ToString();
        //LblCurrentDate.Text = string.Format("{0:dd-MMM-yy}", DateTime.Now);
        //LblCurrentDate.Text = Session["CURRENTDATE"].ToString();
        //LblFYear.Text = Session["FINYEAR"].ToString() + "-" + (Convert.ToDouble(Session["FINYEAR"].ToString()) + 1).ToString();
    }
    private string _GetFinancialYear(string strDate)
    {
        string strFinYear = string.Empty;
        if (strDate != string.Empty)
        {
            string[] str = strDate.Split('/');
            string strMonth = str[1];
            string strYear = str[2];
            if (Convert.ToInt32(strMonth) >= 04 && Convert.ToInt32(strMonth) <= 12)
            {
                strFinYear = strYear;
            }
            else if (Convert.ToInt32(strMonth) >= 1 && Convert.ToInt32(strMonth) < 4)
            {
                strFinYear = (Convert.ToInt32(strYear) - 1).ToString();
            }
        }
        return strFinYear;
    }
}
